package com.media.api;

import com.base.model.R;
import com.media.feignclient.MediaSearchClient;
import com.media.model.Tag;
import com.media.service.TagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: Lenovo
 * @Description: TODO
 * @DateTime: 2023/9/14 15:16
 **/
@RestController
@RequestMapping(value = "/tag")
@Api(tags = "标签接口")
public class TagController {


    @Autowired
    private TagService tagService;

    @ApiOperation("添加新标签")
    @PutMapping("/save")
//    public String saveTag(@RequestBody Tag tag) {
    public R<String> saveTag(@RequestBody Tag tag) {
        return tagService.saveTag(tag);
//        return null;
    }

    @ApiOperation("修改标签")
    @PostMapping("/update")
//    public String updateTag(@RequestBody Tag tag) {
    public R<String> updateTag(@RequestBody Tag tag) {
        return tagService.updateTag(tag);
//        return null;
    }

    @ApiOperation("删除标签")
    @DeleteMapping("/delete/{Id}")
//    public String deleteTag(@PathVariable("Id") Integer Id) {
    public R<String> deleteTag(@PathVariable("Id") Integer Id) {
        return tagService.deleteTag(Id);
//        return null;
    }

    @ApiOperation("获取所有标签")
    @GetMapping("/list")
//    public List<Tag> listTag() {
    public R<List<Tag>> listTag() {
        return tagService.listTag();
//        return null;
    }

}
